<template>
  <div class="risks-list" @click.stop="eventRisksList">
    <div class="item-title">
      <div class="item-img">
        <template v-if="risksItem.pictures && risksItem.pictures.length">
          <img
            :src="risksItem.pictures.split(',')[0]"
            alt=""
            object-fit="scale-down"
          />
        </template>
      </div>
      <div class="item-info">
        <div class="item-info-title">
          <span class="title-text">
            {{ risksItem.checkPoint || "" }}
          </span>
          <span class="title-tip" style="text-align: right;">
            {{ statusArr[risksItem.status] }}
          </span>
        </div>
        <div class="item-info-name">
          {{ risksItem.rectificationLeaderName || "" }}
        </div>
      </div>
    </div>
    <div class="item-body">
      所属部门：{{ risksItem.rectificationDepartmentName || "" }}
    </div>
    <div class="item-body">隐患类型：{{ risksItem.troubleType || "" }}</div>
    <div class="item-body">隐患等级：{{ risksItem.troubleLevel || "" }}</div>
    <div class="item-body">
      {{ (risksItem.status === 7 || risksItem.status === 9) ? "完成时间：" : "整改期限" }}
      <template v-if="risksItem.status === 0 || risksItem.status === 1 || risksItem.status === 3">
        {{ risksItem.rectificationTime | formatDate("YYYY-MM-DD HH:mm") }}
      </template>
      <template v-else-if="risksItem.status === 5">
        整改超时
      </template>
      <template v-else-if="risksItem.status === 7 || risksItem.status === 9">
        {{ risksItem.updateTime | formatDate("YYYY-MM-DD HH:mm") }}
      </template>
      <template v-else>
        {{ risksItem.rectificationTime | formatDate("YYYY-MM-DD HH:mm") }}
      </template>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {      
      statusArr: ["待整改", "待整改", "", "待验收", "", "已逾期", "", "已验收", "", "逾期完成"],
    };
  },
  props: {
    risksItem: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  activated() {},
  methods: {
    eventDetail() {
      this.$emit("eventRisksList", this.risksItem);
    },
    eventRisksList() {
      this.$emit("eventRisksList", this.risksItem);
    },
    eventChildList() {
      this.$emit("eventChildList");
    }
  }
};
</script>
<style lang="less" scoped>
.risks-list {
  padding: 8px;
  height: auto;
  min-height: 80px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  background-color: #292a4d;
  border-radius: 4px;
  .ellipsis {
    display: inherit !important;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .item-title {
    font-size: 17px;
    color: #fff;
    // overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: keep-all;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    &.overdue {
      justify-content: flex-start;
    }
    .item-img {
      width: 52px;
      height: 52px;
      flex: none;
      overflow: hidden;
      img {
        max-width: 100%;
        height: auto;
      }
    }
    .item-info {
      width: 100px;
      height: 52px;
      flex: auto;
      margin-left: 16px;
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      .item-info-title {
        display: flex;
        align-items: center;
        width: 100%;
        overflow: hidden;
      }
      .item-info-name {
        font-size: 14px;
        color: rgba(255, 255, 255, 0.6);
        margin: 6px 0;
      }
    }
    .tag {
      color: #4266d6;
      float: right;
      font-size: 15px;

      &.yollow {
        color: #dd9710;
      }
      &.redy {
        color: #f56c6c;
      }
      &.green {
        color: #67c23a;
      }
    }
    .title-label {
      margin-left: -8px;
      border-radius: 20px;
      border-top-left-radius: 0px;
      border-bottom-left-radius: 0px;
      font-size: 14px;
      padding: 0 12px 1px 8px;
      background-color: #456de6;
      margin-right: 8px;
    }
    .title-text {
      width: 74%;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      flex: none;
    }
    .title-check {
      font-size: 14px;
    }
    .title-tip {
      width: 20%;
      flex: none;
      font-size: 14px;
      // color: #dd9710;
      &.status {
        color: #456de6;
      }
      &.status1,
      &.status4 {
        color: #4fa8e7;
      }
      &.status3 {
        color: #456de6;
      }
      &.status5 {
        color: #dd9710;
      }
      &.status9,
      &.status7 {
        color: #dd9710;
      }
      // &.green {
      //   color: #67c23a;
      // }
      // &.gray {
      //   color: #999;
      // }
    }
  }
  .item-body {
    // color: #456de6;
    font-size: 16px;
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    .body-tag {
      font-size: 14px;
      display: flex;
      align-items: center;
    }
    .item-show {
      color: #fff;
      font-size: 14px;
      width: 52px;
      padding: 1px 0;
      flex: none;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 80px;
      border: 1px solid #456de6;
    }
  }
  .item-body-other {
    color: rgba(255, 255, 255, 0.6);
  }
  .item-bottom {
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    .child-body-state {
      margin-left: 8px;
      padding: 0 2px 1px;
      color: #456de6;
      border: 1px solid #456de6;
      border-radius: 2px;
    }
    .handle-btn {
      margin-left: 8px;
      flex: none;
    }
    .btn {
      color: #fff;
      font-size: 14px;
      background-color: #456de6;
      padding: 2px 11px 3px;
      border-radius: 12px;
    }
  }
  .item-chlid {
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    padding-bottom: 6px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    .child-title {
      color: #fff;
      // overflow: hidden;
      font-size: 16px;
      text-overflow: ellipsis;
      white-space: nowrap;
      word-break: keep-all;
      display: flex;
      align-items: center;
      // justify-content: space-between;

      .child-label {
        font-size: 14px;
        margin-right: 8px;
        padding: 0 6px 1px;
        color: #fff;
        border: 1px solid #456de6;
        border-radius: 2px;
      }
      .child-tip {
        width: 100%;
        margin-right: 8px;
        font-size: 14px;
        &.status {
          color: #dd9710;
        }
        &.status {
          color: #456de6;
        }
        &.status1,
        &.status4 {
          color: #4fa8e7;
        }
        &.status3 {
          color: #456de6;
        }
        &.status5 {
          color: #dd9710;
        }
        &.status9,
        &.status7 {
          color: #dd9710;
        }
      }
    }

    .child-body {
      font-size: 14px;
      margin: 4px 0;
      display: flex;
      flex-direction: column;
      // align-items: center;
      // justify-content: space-between;
      .child-list {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.5);
        .list-text {
          width: 100%;
          padding: 0 8px;
        }
      }
      .detail-btn {
        width: 100%;
        margin-top: 16px;
        .btn {
          width: 100px;
          margin: 0 auto;
          padding: 6px 0;
          font-size: 14px;
          color: #ffffff;
          text-align: center;
          background: #3967dc;
          border-radius: 5px;
        }
      }
      .child-body-state {
        margin-left: 8px;
        padding: 0 2px 1px;
        color: #456de6;
        border: 1px solid #456de6;
        border-radius: 2px;
      }
      &.handle {
        justify-content: space-between;
        color: #fff;
      }
    }
    .handle-btn {
      margin-left: 8px;
      flex: none;
    }
    .btn {
      color: #fff;
      font-size: 14px;
      background-color: #456de6;
      padding: 2px 11px 3px;
      border-radius: 12px;
    }
  }
  .their {
    font-size: 14px;
    color: #fff;
  }
  .more  {
    display: -webkit-box !important;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-all;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .time {
    font-size: 14px;
    color: rgba(69, 109, 230, 1);
  }
  .newpage_work_more {
    height: 40px;
    font-size: 12px;
    line-height: 40px;
    text-align: center;
    color: #456de6;
  }
}
</style>
